<?php
/**
 * Description of class_template
 * PHP Class that it interacts with the template. Three main functions:
 * -LoadTemplate, load in memory the template with the keys.
 * -ChangeData, this function allows to change the key for data.
 * -PublishTemplate, when all changes are finished. It is able to publish the
 * template with real data. 
 * 
 * @author Guillermo
 */
class TemplateHTML {
    
    public $Template;
    
    /**
     * Method that loads the template with the keys in the memory of the program.
     * It has got one parameter, the path of the template file.
     * @param type $file
     */
    public function LoadTemplate($file)
    {
        $this->Template = file_get_contents($file);
        
    }
    
    /**
     * Method that changes one key in the template for data. It has got two 
     * parameters, one is the key and another is the data.
     * @param type $key
     * @param type $data
     * 
     */
    public function ChangeData($key, $data){
        $this->Template = str_replace("$key",$data,$this->Template);
    }
    
    /**
     * Method that publish the final HTML template.
     */
    public function  PublishTemplate(){
        eval("?>".$this->Template."<?");
        
    }
    
}

?>
